CHAPTER 19 Other Useful Kinds of Regression 277
Examining nonlinear trends
The straight line in Figure 19-3 doesn’t account for the fact that the accident rate
remained low for the first few years and then started to climb rapidly after 2016.
Perhaps the true trend isn’t a straight line, where the rate increases by the same
amount each year. It may instead be an exponential increase, where the rate
increases by a certain percentage each year. You can have R fit an exponential
increase by changing the link option from identity to log in the statement that
invokes the Poisson regression:
glm(formula = Accidents ~ Year, family = poisson(link = “log”))
This produces the output shown in Figure 19-4 and graphed in Figure 19-5.
Because of the log link used in this regression run, the coefficients are related to
the logarithm of the event rate. Thus, the relative rate of increase per year is
obtained by taking the antilog of the regression coefficient for Year. This is done
by raising e (the mathematical constant 2.718. . .) to the power of the regression
coefficient for Year: e0 10414
.
, which is about 1.11. So, according to an exponential
increase model, the annual accident rate increases by a factor of 1.11 each year —
meaning there is an 11 percent increase each year. The dashed-line curve in
Figure 19-4 shows this exponential trend, which appears to accommodate the
steeper rate of increase seen after 2016.
Comparing alternative models
The bottom of Figure 19-4 shows the AIC value for the exponential trend model is
78.476, which is about 3.2 units lower than for the linear trend model in
Figure 19-2 (AIC 81.72). Smaller AIC values indicate better fit, so the true trend
is more likely to be exponential rather than linear. But you can’t conclude that the
model with the lower AIC is really better unless the AIC is about six units better.
So in this example, you can’t say for sure whether the trend is linear or exponen-
tial, or potentially another distribution. But the exponential curve does seem to
predict the high accident rates seen in 2020 and 2021 better than the linear trend
model.
FIGURE 19-4:
Output from an
exponential trend
Poisson
regression.